//
//  TTRecyclingAskPriceView.m
//  TaoTuo
//
//  Created by LG on 2020/9/16.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "TTRecyclingAskPriceView.h"
#import <UIView+TYAlertView.h>

@interface TTRecyclingAskPriceView ()

@property (weak, nonatomic) IBOutlet UIImageView *headerImgView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UIButton *callBtn;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;


@end

@implementation TTRecyclingAskPriceView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.layer.cornerRadius = 10;
    
    self.headerImgView.layer.cornerRadius = 35;
    self.headerImgView.layer.masksToBounds = YES;
    
    self.callBtn.layer.borderColor = UIColorHex(#AE79EF).CGColor;
    self.callBtn.layer.borderWidth = 0.5;
    self.callBtn.layer.cornerRadius = 9;
    
    [self.shareBtn addGradientRampWithColors:@[UIColorHex(#BD86FD), UIColorHex(#9343EB)] colorDirection:VerticalDirection];
    self.shareBtn.layer.cornerRadius = 17.5;
    self.shareBtn.layer.masksToBounds = YES;
    
    NSString *headerUrlStr = [TTLoginSingle sharedSingle].loginModel.SalesmanPicture;
    NSURL *url = [NSURL URLWithString:headerUrlStr];
    [self.headerImgView sd_setImageWithURL:url placeholderImage:nil options:SDWebImageRetryFailed];
    
    self.nameLabel.text = [TTLoginSingle sharedSingle].loginModel.SalesmanAccountName;
    self.phoneLabel.text = [TTLoginSingle sharedSingle].loginModel.SalesmanMobile;
    
}

- (IBAction)closeAction:(id)sender {
    
    [self hideView];
    
}

// 打电话
- (IBAction)callBtnAction:(id)sender {
    
    [[TTLoginSingle sharedSingle].loginModel.SalesmanMobile callPhone];
    
}

// 分享
- (IBAction)shareAction:(id)sender {
    
    [self hideView];
    if (self.shareBlock) {
        self.shareBlock();
    }
}

@end
